<?php
/**
 * Created by PhpStorm.
 * User: meng
 * Date: 2021/7/6
 * Time: 11:16 上午
 */

namespace app\admin\controller;


use app\BaseController;
use think\exception\HttpResponseException;
use think\Response;

class AdminBaseController extends BaseController
{
    final public function writeJson ($data = null, $msg = 'success', $code = 200) {
        $result = [
            'code' => 1,
            'msg'  => $msg,
            'data' => $data
        ];
        $response = Response::create($result, 'json', $code);
        throw new HttpResponseException($response);
    }
}
